<template>
  <div class="toast" v-show="isShow">
    <div>{{ message }}</div>
  </div>
</template>

<script>
export default {
  props: {
    //这些值不是传过来的了
    // message: {
    //   type: String,
    //   default: "",
    // },
    // show: {
    //   type: Boolean,
    //   default: false,
    // },
  },
  data() {
    return {
      message:  "",
      isShow: false,
    };
  },
  methods: {
    show(msg, duration = 2000) {
      this.message = msg;
      this.isShow = true;
      setTimeout(() => {
        this.isShow = false;
        this.toastMsg = "";
      }, duration);
    },
  },
};
</script>

<style scoped>
.toast {
  height: 100vh;
  width: 100vw;
  display: flex;
  justify-content: center;
  align-items: center;
}
.toast div {
  padding: 10px;
  border-radius: 10px;
  background-color: rgba(0, 0, 0, 0.5);
  color: white;
}
</style>